{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "4c0a4d83",
   "metadata": {},
   "source": [
    "## NLP(自然语言处理）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "67e3e6b0",
   "metadata": {},
   "source": [
    "### 1.什么是自然语言处理？     \n",
    "* 1.Machin Translation（机器翻译）：谷歌、有道翻译      \n",
    "* 2.Chinese word segmentation（中文自动分词）      \n",
    "* 3.Question Answering（问答系统）：openai、文心一言     \n",
    "* 4.Information Extracting（信息抽取）      \n",
    "* 5.Reading comprehension（阅读理解）      \n",
    "* 6.Automatic summarization(自动摘要)       \n",
    "* 7.Text categorization（文本分类)      \n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "31702fc6",
   "metadata": {},
   "source": [
    "### 2.计算机也能理解语言吗？      \n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "2ee3549d",
   "metadata": {},
   "source": [
    "### 3.词向量是什么？"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "35a6f036",
   "metadata": {},
   "source": [
    "## 百度AI实践"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3956743d",
   "metadata": {},
   "source": [
    "* 1.自然语言处理文本信息（实践）      \n",
    "* 2.自然语言生成文本信息（实践）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "31c007b5",
   "metadata": {},
   "source": [
    "## 对话机器人        "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "88a4620b",
   "metadata": {},
   "source": [
    "* 1.对话机器人（实践）"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c3728b62",
   "metadata": {},
   "source": [
    "## OpenAI接入教程    \n",
    "* 链接(https://www.bilibili.com/video/BV1rs4y187gi/?spm_id_from=333.337.search-card.all.click&vd_source=79597b80e427bf7da87d79b5fa58a48e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f9b8f857",
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests,json\n",
    "url = 'http://openapi.turingapi.com/openapi/api/v2'\n",
    "data = {\n",
    "    \"reqType\":0,\n",
    "    \"perception\": {\n",
    "        \"inputText\": {\n",
    "            \"text\": \"聊点什么呢\"\n",
    "        },\n",
    "        \"inputImage\": {\n",
    "            \"url\": \"\"\n",
    "        },\n",
    "\n",
    "    },\n",
    "    \"userInfo\": {\n",
    "        \"apiKey\": \"d5d5bb66f66d4da8bedb378df7adfa70\",\n",
    "        \"userId\": \"111\"\n",
    "    }\n",
    "}\n",
    "\n",
    "r = requests.post(url,json.dumps(data))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "e04e4bd8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<Response [200]>"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "73bc3e73",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'emotion': {'robotEmotion': {'a': 0, 'd': 0, 'emotionId': 0, 'p': 0},\n",
       "  'userEmotion': {'a': 0, 'd': 0, 'emotionId': 0, 'p': 0}},\n",
       " 'intent': {'appKey': 'platform.chat', 'code': 0, 'operateState': 1100},\n",
       " 'results': [{'groupType': 0,\n",
       "   'resultType': 'text',\n",
       "   'values': {'text': '随便，我啥都会聊'}}]}"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "r.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "51af5779",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
